<?php
/*******************************************************************************
 * $Date:: Jan 06, 2011 11:56:54 PM                                            $
 * $Revision:                                                                  $
 * $Author:: Tuan Duong                                                        $
 * $Comment::                                                                  $
 ******************************************************************************/

/**
 * Initial variables
 *
 * @package Lua
 * @author Tuan Duong <tuan[at]smartdzine[dot]com>
 * @version
 */

date_default_timezone_set('Asia/Saigon');
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
defined('ROOT_PATH') || define('ROOT_PATH', realpath(dirname(__FILE__) . '/../'));
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . DS . '..' . DS . 'application'));
defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));

// Define lib path
set_include_path(implode(PATH_SEPARATOR, array(
    ROOT_PATH . DS . 'vendor',
    ROOT_PATH . DS . 'library',
    APPLICATION_PATH . DS . 'controllers',
    get_include_path()
)));
include_once 'Lua/Application.php';
include_once 'Lua/Captcha/recaptchalib.php';
try {
    $application = new Lua_Application();
    Zend_Controller_Front::getInstance()->setBaseUrl(Lua_Uri::getInstance()->getServer("SCRIPT_NAME"));
    $application->run();
} catch (Exception $ex) {
    echo get_class($ex) . " : " . $ex->getMessage();
    echo '<pre>' . $ex->getTraceAsString() . '</pre>';
    echo "<br />";
}